import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import fs from "fs";
import path from "path";

// const dir = process.cmd()
// 获取https的证书
// const httpsOptions = {
//   key: fs.readFileSync(path.join(dir, 'cert', 'key.pem')),
//   cert: fs.readFileSync(path.join(dir, 'cert', 'cert.pem')),
// }


async function bootstrap() {
  // cors: true 允许跨域
  const app = await NestFactory.create(AppModule, {
    cors: true,
    // httpsOptions: httpsOptions // 启用https
  });
  await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
